package com.bizuma.template.provider.impl;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceUnit;

import com.bizuma.template.domain.Person;
import com.bizuma.template.provider.PersonService;

public class PersonServiceImpl implements PersonService {

	@PersistenceUnit
	private EntityManagerFactory emFactory;

	public void setEmFactory(EntityManagerFactory emFactory) {
		this.emFactory = emFactory;
	}

	public void registerPerson(Person person) {
		EntityManager em = emFactory.createEntityManager();
		em.getTransaction().begin();
		em.persist(person);
		em.getTransaction().commit();
	}
	

}
